import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PaymentMethodVO, PaymentMethodForm, PaymentMethodQuery } from '@/api/goods/paymentMethod/types';

/**
 * 查询回款方式列表
 * @param query
 * @returns {*}
 */

export const listPaymentMethod = (query?: PaymentMethodQuery): AxiosPromise<PaymentMethodVO[]> => {
  return request({
    url: '/order/paymentMethod/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询回款方式详细
 * @param id
 */
export const getPaymentMethod = (id: string | number): AxiosPromise<PaymentMethodVO> => {
  return request({
    url: '/order/paymentMethod/' + id,
    method: 'get'
  });
};

/**
 * 新增回款方式
 * @param data
 */
export const addPaymentMethod = (data: PaymentMethodForm) => {
  return request({
    url: '/order/paymentMethod',
    method: 'post',
    data: data
  });
};

/**
 * 修改回款方式
 * @param data
 */
export const updatePaymentMethod = (data: PaymentMethodForm) => {
  return request({
    url: '/order/paymentMethod',
    method: 'put',
    data: data
  });
};

/**
 * 删除回款方式
 * @param id
 */
export const delPaymentMethod = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/paymentMethod/' + id,
    method: 'delete'
  });
};

export default {
  list: listPaymentMethod,


  get: getPaymentMethod,


  add: addPaymentMethod,
  update: updatePaymentMethod,


  del: delPaymentMethod,
}